<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>DOM事件练习 | 个人笔记</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../../md/js/DOM鼠标事件.html" />
    
    
    <link rel="prev" href="../../md/js/DOM元素对象.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="3.23"
        data-chapter-title="DOM事件练习"
        data-filepath="md/js/DOM事件练习.md"
        data-basepath="../.."
        data-revision="Sat Oct 13 2018 16:22:38 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        Introduction
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="md/html/html介绍.html">
            
                
                    <a href="../../md/html/html介绍.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        html介绍
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="md/html/html常用标签.html">
            
                
                    <a href="../../md/html/html常用标签.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        html常用标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="md/html/a标签的使用.html">
            
                
                    <a href="../../md/html/a标签的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        a标签的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="md/html/表格的介绍.html">
            
                
                    <a href="../../md/html/表格的介绍.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        表格的介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="md/html/列表.html">
            
                
                    <a href="../../md/html/列表.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        列表
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="md/html/iframe内嵌框架.html">
            
                
                    <a href="../../md/html/iframe内嵌框架.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        iframe内嵌框架
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="md/html/表单.html">
            
                
                    <a href="../../md/html/表单.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        表单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="md/html/媒体标签.html">
            
                
                    <a href="../../md/html/媒体标签.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.7.</b>
                        
                        媒体标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="md/html/下拉框，多行文本域以及对齐方式.html">
            
                
                    <a href="../../md/html/下拉框，多行文本域以及对齐方式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.8.</b>
                        
                        清除样式
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="md/css/css引入方式.html">
            
                
                    <a href="../../md/css/css引入方式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        css引入方式
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="md/css/css选择符与选择器.html">
            
                
                    <a href="../../md/css/css选择符与选择器.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        css选择符与选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="md/css/css字体样式.html">
            
                
                    <a href="../../md/css/css字体样式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        css字体样式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="md/css/图片的调整.html">
            
                
                    <a href="../../md/css/图片的调整.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        图片的调整
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="md/css/伪类选择.html">
            
                
                    <a href="../../md/css/伪类选择.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        伪类选择
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="md/css/盒子模型.html">
            
                
                    <a href="../../md/css/盒子模型.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        盒子模型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="md/css/浮动.html">
            
                
                    <a href="../../md/css/浮动.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.6.</b>
                        
                        浮动
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="md/css/定位.html">
            
                
                    <a href="../../md/css/定位.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.7.</b>
                        
                        定位
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="md/css/阴影.html">
            
                
                    <a href="../../md/css/阴影.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.8.</b>
                        
                        阴影
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="md/css/图片溢出处理.html">
            
                
                    <a href="../../md/css/图片溢出处理.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.9.</b>
                        
                        图片溢出处理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.10" data-path="md/css/动画.html">
            
                
                    <a href="../../md/css/动画.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.10.</b>
                        
                        动画
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.11" data-path="md/css/动画插件与浏览器内核.html">
            
                
                    <a href="../../md/css/动画插件与浏览器内核.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.11.</b>
                        
                        动画插件与浏览器内核
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.12" data-path="md/css/旋转菜单.html">
            
                
                    <a href="../../md/css/旋转菜单.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.12.</b>
                        
                        旋转菜单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.13" data-path="md/css/视口.html">
            
                
                    <a href="../../md/css/视口.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.13.</b>
                        
                        移动端
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.14" data-path="md/css/rem布局.html">
            
                
                    <a href="../../md/css/rem布局.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.14.</b>
                        
                        rem布局
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.15" data-path="md/css/权重与雪碧图.html">
            
                
                    <a href="../../md/css/权重与雪碧图.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.15.</b>
                        
                        权重问题
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.16" data-path="md/css/移动底部菜单被系统键盘顶起问题.html">
            
                
                    <a href="../../md/css/移动底部菜单被系统键盘顶起问题.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.16.</b>
                        
                        移动端导航问题
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.17" data-path="md/css/flex布局.html">
            
                
                    <a href="../../md/css/flex布局.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.17.</b>
                        
                        flex布局
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.18" data-path="md/css/fullpage的使用.html">
            
                
                    <a href="../../md/css/fullpage的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.18.</b>
                        
                        fullpage
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.19" data-path="md/css/bootstrap.html">
            
                
                    <a href="../../md/css/bootstrap.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.19.</b>
                        
                        bootstrap
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.20" data-path="md/css/媒体查询.html">
            
                
                    <a href="../../md/css/媒体查询.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.20.</b>
                        
                        媒体查询
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="md/js/js的介绍.html">
            
                
                    <a href="../../md/js/js的介绍.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        JavaScript的介绍
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="md/js/JavaScript数据类型.html">
            
                
                    <a href="../../md/js/JavaScript数据类型.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        JavaScript数据类型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="md/js/数据类型的转换.html">
            
                
                    <a href="../../md/js/数据类型的转换.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        数据类型的转换
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="md/js/运算符.html">
            
                
                    <a href="../../md/js/运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="md/js/比较运算符.html">
            
                
                    <a href="../../md/js/比较运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.4.</b>
                        
                        比较运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="md/js/赋值运算符.html">
            
                
                    <a href="../../md/js/赋值运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.5.</b>
                        
                        赋值运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="md/js/逻辑操作符.html">
            
                
                    <a href="../../md/js/逻辑操作符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.6.</b>
                        
                        逻辑操作符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="md/js/条件语句.html">
            
                
                    <a href="../../md/js/条件语句.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.7.</b>
                        
                        条件语句
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.8" data-path="md/js/条件运算符.html">
            
                
                    <a href="../../md/js/条件运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.8.</b>
                        
                        条件运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.9" data-path="md/js/位运算符.html">
            
                
                    <a href="../../md/js/位运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.9.</b>
                        
                        位运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.10" data-path="md/js/循环语句.html">
            
                
                    <a href="../../md/js/循环语句.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.10.</b>
                        
                        循环语句
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.11" data-path="md/js/for循环.html">
            
                
                    <a href="../../md/js/for循环.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.11.</b>
                        
                        for循环
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.12" data-path="md/js/ES6.html">
            
                
                    <a href="../../md/js/ES6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.12.</b>
                        
                        ES6
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.13" data-path="md/js/es6安装.html">
            
                
                    <a href="../../md/js/es6安装.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.13.</b>
                        
                        ES6安装
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.14" data-path="md/js/内置对象.html">
            
                
                    <a href="../../md/js/内置对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.14.</b>
                        
                        内置对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.15" data-path="md/js/Array对象.html">
            
                
                    <a href="../../md/js/Array对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.15.</b>
                        
                        Array对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.16" data-path="md/js/Date对象.html">
            
                
                    <a href="../../md/js/Date对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.16.</b>
                        
                        Date对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.17" data-path="md/js/布尔值对象.html">
            
                
                    <a href="../../md/js/布尔值对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.17.</b>
                        
                        布尔值对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.18" data-path="md/js/数学对象.html">
            
                
                    <a href="../../md/js/数学对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.18.</b>
                        
                        数学对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.19" data-path="md/js/对象的创建.html">
            
                
                    <a href="../../md/js/对象的创建.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.19.</b>
                        
                        对象的创建
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.20" data-path="md/js/BOM.html">
            
                
                    <a href="../../md/js/BOM.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.20.</b>
                        
                        BOM
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.21" data-path="md/js/DOM关于元素的获取.html">
            
                
                    <a href="../../md/js/DOM关于元素的获取.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.21.</b>
                        
                        DOM关于元素的获取
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.22" data-path="md/js/DOM元素对象.html">
            
                
                    <a href="../../md/js/DOM元素对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.22.</b>
                        
                        DOM元素对象
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="3.23" data-path="md/js/DOM事件练习.html">
            
                
                    <a href="../../md/js/DOM事件练习.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.23.</b>
                        
                        DOM事件练习
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.24" data-path="md/js/DOM鼠标事件.html">
            
                
                    <a href="../../md/js/DOM鼠标事件.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.24.</b>
                        
                        DOM鼠标事件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.25" data-path="md/js/事件代理.html">
            
                
                    <a href="../../md/js/事件代理.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.25.</b>
                        
                        事件代理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.26" data-path="md/js/移动端事件.html">
            
                
                    <a href="../../md/js/移动端事件.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.26.</b>
                        
                        移动端事件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.27" data-path="md/js/无缝轮播图.html">
            
                
                    <a href="../../md/js/无缝轮播图.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.27.</b>
                        
                        无缝轮播图
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.28" data-path="md/js/鼠标事件练习.html">
            
                
                    <a href="../../md/js/鼠标事件练习.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.28.</b>
                        
                        鼠标事件练习
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.29" data-path="md/js/ajax.html">
            
                
                    <a href="../../md/js/ajax.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.29.</b>
                        
                        ajax
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.30" data-path="md/js/封装ajax.html">
            
                
                    <a href="../../md/js/封装ajax.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.30.</b>
                        
                        封装ajax
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.31" data-path="md/js/高德地图的使用.html">
            
                
                    <a href="../../md/js/高德地图的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.31.</b>
                        
                        高德地图的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.32" data-path="md/js/预加载插件使用.html">
            
                
                    <a href="../../md/js/预加载插件使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.32.</b>
                        
                        预加载插件使用
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="md/jQuery/JQ变量的声明.html">
            
                
                    <a href="../../md/jQuery/JQ变量的声明.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        JQ变量的声明
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="md/jQuery/选择器和效果.html">
            
                
                    <a href="../../md/jQuery/选择器和效果.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        选择器和效果
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="md/jQuery/属性.html">
            
                
                    <a href="../../md/jQuery/属性.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        属性
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="md/jQuery/尺寸.html">
            
                
                    <a href="../../md/jQuery/尺寸.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.</b>
                        
                        尺寸
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="md/jQuery/遍历.html">
            
                
                    <a href="../../md/jQuery/遍历.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.</b>
                        
                        遍历
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="md/jQuery/正则表达式.html">
            
                
                    <a href="../../md/jQuery/正则表达式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.5.</b>
                        
                        正则表达式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="md/jQuery/jQuery事件练习.html">
            
                
                    <a href="../../md/jQuery/jQuery事件练习.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.6.</b>
                        
                        jQuery事件练习
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.7" data-path="md/jQuery/操作.html">
            
                
                    <a href="../../md/jQuery/操作.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.7.</b>
                        
                        操作
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.8" data-path="md/jQuery/事件.html">
            
                
                    <a href="../../md/jQuery/事件.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.8.</b>
                        
                        事件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.9" data-path="md/jQuery/ajax.html">
            
                
                    <a href="../../md/jQuery/ajax.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.9.</b>
                        
                        ajax
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.10" data-path="md/jQuery/三级联动.html">
            
                
                    <a href="../../md/jQuery/三级联动.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.10.</b>
                        
                        三级联动
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.11" data-path="md/jQuery/滚动监听导航效果.html">
            
                
                    <a href="../../md/jQuery/滚动监听导航效果.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.11.</b>
                        
                        滚动监听导航效果
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.12" data-path="md/jQuery/悬停导航.html">
            
                
                    <a href="../../md/jQuery/悬停导航.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.12.</b>
                        
                        悬停导航
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="md/Vue/修饰符与条件渲染.html">
            
                
                    <a href="../../md/Vue/修饰符与条件渲染.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        Vue修饰符与条件渲染
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1" data-path="md/Vue/绑定class和style.html">
            
                
                    <a href="../../md/Vue/绑定class和style.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        绑定class和style
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="md/Vue/排序.html">
            
                
                    <a href="../../md/Vue/排序.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        排序
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="md/Vue/表单输入绑定.html">
            
                
                    <a href="../../md/Vue/表单输入绑定.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.</b>
                        
                        表单输入绑定
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="md/Vue/生命周期.html">
            
                
                    <a href="../../md/Vue/生命周期.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.4.</b>
                        
                        生命周期
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.5" data-path="md/Vue/自定义指令.html">
            
                
                    <a href="../../md/Vue/自定义指令.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.5.</b>
                        
                        自定义指令
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.6" data-path="md/Vue/组件.html">
            
                
                    <a href="../../md/Vue/组件.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.6.</b>
                        
                        组件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.7" data-path="md/Vue/Vue事件练习.html">
            
                
                    <a href="../../md/Vue/Vue事件练习.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.7.</b>
                        
                        Vue事件练习
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.8" data-path="md/Vue/动态模板.html">
            
                
                    <a href="../../md/Vue/动态模板.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.8.</b>
                        
                        动态模板
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.9" data-path="md/Vue/插槽的使用.html">
            
                
                    <a href="../../md/Vue/插槽的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.9.</b>
                        
                        插槽的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.10" data-path="md/Vue/router.html">
            
                
                    <a href="../../md/Vue/router.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.10.</b>
                        
                        router
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.11" data-path="md/Vue/ajax与框架搭建.html">
            
                
                    <a href="../../md/Vue/ajax与框架搭建.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.11.</b>
                        
                        ajax与框架搭建
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.12" data-path="md/Vue/store.html">
            
                
                    <a href="../../md/Vue/store.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.12.</b>
                        
                        store
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.13" data-path="md/Vue/ref获取元素.html">
            
                
                    <a href="../../md/Vue/ref获取元素.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.13.</b>
                        
                        ref获取元素
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6" data-path="md/wx/小程序.html">
            
                
                    <a href="../../md/wx/小程序.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        小程序
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1" data-path="md/wx/封装外部ajax路径.html">
            
                
                    <a href="../../md/wx/封装外部ajax路径.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.1.</b>
                        
                        封装外部ajax路径
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="md/wx/练习.html">
            
                
                    <a href="../../md/wx/练习.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.</b>
                        
                        练习
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7" data-path="md/Egret/canvas.html">
            
                
                    <a href="../../md/Egret/canvas.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.</b>
                        
                        canvas
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.1" data-path="md/Egret/async.html">
            
                
                    <a href="../../md/Egret/async.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.1.</b>
                        
                        async
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.2" data-path="md/Egret/显示对象与容器.html">
            
                
                    <a href="../../md/Egret/显示对象与容器.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.2.</b>
                        
                        显示对象与容器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.3" data-path="md/Egret/01.基础.html">
            
                
                    <a href="../../md/Egret/01.基础.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.3.</b>
                        
                        01.基础
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.4" data-path="md/Egret/02.对象池.html">
            
                
                    <a href="../../md/Egret/02.对象池.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.4.</b>
                        
                        02.对象池
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.5" data-path="md/Egret/03.typeScript.html">
            
                
                    <a href="../../md/Egret/03.typeScript.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.5.</b>
                        
                        03.typeScript
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.6" data-path="md/Egret/04.场景管理类.html">
            
                
                    <a href="../../md/Egret/04.场景管理类.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.6.</b>
                        
                        04.场景管理类
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="8" data-path="gitbook的安装.html">
            
                
                    <a href="../../gitbook的安装.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.</b>
                        
                        gitbook的安装
                    </a>
            
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../" >个人笔记</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="&#x5012;&#x5E8F;&#x5FAA;&#x73AF;&#x4E0E;&#x653E;&#x5927;">&#x5012;&#x5E8F;&#x5FAA;&#x73AF;&#x4E0E;&#x653E;&#x5927;</h1>
<pre><code>        &lt;style type=&quot;text/css&quot;&gt;
            li{
                list-style: none;
            }
            .scal{
                font-size: 70px;
            }
            p{
                font-size: 12px;
                transition: 1s;
            }
        &lt;/style&gt;
        &lt;ul class=&quot;test&quot;&gt;
            &lt;li&gt;&#x7B2C;1&#x6BB5;&#x8BDD;&lt;/li&gt;
            &lt;li&gt;&#x7B2C;2&#x6BB5;&#x8BDD;&lt;/li&gt;
            &lt;li&gt;&#x7B2C;3&#x6BB5;&#x8BDD;&lt;/li&gt;
            &lt;li&gt;&#x7B2C;4&#x6BB5;&#x8BDD;&lt;/li&gt;
            &lt;li&gt;&#x7B2C;5&#x6BB5;&#x8BDD;&lt;/li&gt;
        &lt;/ul&gt;
        &lt;p&gt;JavaScript&lt;/p&gt;
        &lt;script type=&quot;text/javascript&quot;&gt;
            var ul=document.querySelector(&quot;.test&quot;);
            setInterval(function(){
                var ali=document.querySelectorAll(&quot;.test li&quot;);
                var firstli=ali[0];
                ul.appendChild(firstli);
            },1000);

            var pele=document.querySelector(&quot;p&quot;);
            setInterval(function(){
                pele.classList.toggle(&quot;scal&quot;);
            },1000)
        &lt;/script&gt;
</code></pre><h1 id="&#x56FE;&#x7247;&#x6536;&#x8D77;&#x4E0E;&#x56DE;&#x5230;&#x9876;&#x90E8;">&#x56FE;&#x7247;&#x6536;&#x8D77;&#x4E0E;&#x56DE;&#x5230;&#x9876;&#x90E8;</h1>
<pre><code>        &lt;style type=&quot;text/css&quot;&gt;
            .img{
                width: 140px;
                height: 200px;
                overflow: hidden;
                transition: 1s;
            }
            .img img{
                width: 100%;
            }
            .slide{
                height: 0px;
            }

            .bcaktop {
                width: 30px;
                text-align: center;
                font-size: 14px;
                position: fixed;
                right: 10px;
                bottom: 30px;
                background: skyblue;
                color: #fff;
                cursor: pointer;
            }
        &lt;/style&gt;
        &lt;div class=&quot;img&quot;&gt;&lt;img src=&quot;img/dongtai-4.png&quot; /&gt;&lt;/div&gt;
        &lt;div class=&quot;btn&quot;&gt;
            &lt;button&gt;&#x6536;&#x8D77;&lt;/button&gt;
            &lt;button&gt;&#x5C55;&#x5F00;&lt;/button&gt;
            &lt;button&gt;&#x5207;&#x6362;&lt;/button&gt;
            &lt;button&gt;&#x5207;&#x6362;&#x56FE;&#x7247;&lt;/button&gt;
        &lt;/div&gt;
        &lt;div style=&quot;height: 1000px;&quot;&gt;&lt;/div&gt;
        &lt;button class=&quot;bcaktop&quot;&gt;&#x56DE;&#x5230;&#x9876;&#x90E8;&lt;/button&gt;
        &lt;script type=&quot;text/javascript&quot;&gt;
                        //&#x6536;&#x8D77;&#x6309;&#x94AE;
                        btn[0].addEventListener(&quot;click&quot;,function(){
                            img.classList.add(&quot;slide&quot;);
                        })
                        //&#x5C55;&#x5F00;&#x6309;&#x94AE;
                        btn[1].addEventListener(&quot;click&quot;,function(){
                            //&#x79FB;&#x9664;&#x7C7B;&#x540D;
                            img.classList.remove(&quot;slide&quot;);
                        })
                        //&#x5207;&#x6362;&#x6309;&#x94AE;
                        btn[2].addEventListener(&quot;click&quot;,function(){
                            //&#x79FB;&#x9664;&#x7C7B;&#x540D;
                            img.classList.toggle(&quot;slide&quot;);
                        })
                        //&#x5207;&#x6362;&#x56FE;&#x7247;
                        //&#x83B7;&#x53D6;img&#x6807;&#x7B7E;
                        //&#x5143;&#x7D20;&#x4E5F;&#x5177;&#x6709;querySelector()&#x8FD9;&#x4E2A;&#x65B9;&#x6CD5;
                        var imgele = img.querySelector(&quot;img&quot;);
                        var arr= [&quot;img/youxi-10.png&quot;,&quot;img/youxi-12.png&quot;,&quot;img/youxi-13.png&quot;,&quot;img/youxi-14.png&quot;,&quot;img/youxi-15.png&quot;,]
                        btn[3].addEventListener(&quot;click&quot;,function(){

                            var i=Math.floor( Math.random()*arr.length);

                                imgele.setAttribute(&quot;src&quot;,arr[i]);

                        })
            //window.onload&#x6574;&#x4E2A;&#x9875;&#x9762;(&#x5305;&#x62EC;&#x56FE;&#x7247;&#xFF0C;css&#xFF0C;&#x5916;&#x90E8;js&#x7B49;)&#x52A0;&#x8F7D;&#x5B8C;&#x4E4B;&#x540E;&#x518D;&#x6267;&#x884C;&#x91CC;&#x9762;&#x7684;js&#x4EE3;&#x7801;
            window.onload = function() {
                var btn = document.querySelectorAll(&quot;.btn button&quot;);
                var img = document.querySelector(&quot;.img&quot;);
                var imgele = img.querySelector(&quot;img&quot;);
                var imgelew = imgele.offsetWidth;
                    imgeleh = imgele.offsetHeight;
                img.style.width = imgelew + &quot;px&quot;;
                img.style.height = imgeleh + &quot;px&quot;;
                img.style.overflow = &quot;hidden&quot;;
                var num = imgeleh;
                //&#x6536;&#x8D77;
                btn[0].addEventListener(&quot;click&quot;, function() {
                    var timer = setInterval(function() {
                        num -= 2;
                        img.style.height = num + &quot;px&quot;;
                        img.style.transition=&quot;1s&quot;;
                        if(num &lt;= 0) {
                            //&#x6E05;&#x9664;&#x5B9A;&#x65F6;&#x5668;
                            clearInterval(timer);
                        };

                    });
                });

                //&#x5C55;&#x5F00;
                btn[1].addEventListener(&quot;click&quot;, function() {
                    var str= true;
                    var timer = setInterval(function() {
                        num += 2;
                        img.style.height = num + &quot;px&quot;;
                        img.style.transition=&quot;1s&quot;;
                        if(num &gt;= imgeleh) {
                            //&#x6E05;&#x9664;&#x5B9A;&#x65F6;&#x5668;
                            clearInterval(timer);

                        };
                        if(str){
                            num=imgeleh;
                        };
                    });
                });
            }

            //&#x56DE;&#x5230;&#x9876;&#x90E8;
            var backtop = document.querySelector(&quot;.bcaktop&quot;);
            /**
             * 1&#x3001;&#x83B7;&#x53D6;&#x6EDA;&#x52A8;&#x6761;&#x7684;&#x4F4D;&#x7F6E;
             * window.pageYoffset
             * 2&#x3002;&#x8BBE;&#x7F6E;&#x6EDA;&#x52A8;&#x6761;&#x4F4D;&#x7F6E;&#x7684;&#x65B9;&#x6CD5;
             * window.moveTo(x,y)
             * */
            backtop.addEventListener(&quot;click&quot;, function() {
                var scrolly = window.pageYOffset;
                var timer = setInterval(function() {
                    scrolly -= 10;
                    window.scrollTo(0, scrolly);
                    if(scrolly &lt;= 0) {
                        clearInterval(timer);
                    }
                }, 10);
            })

            //&#x9009;&#x9879;&#x5361;

        &lt;/script&gt;
</code></pre><h1 id="&#x9009;&#x9879;&#x5361;">&#x9009;&#x9879;&#x5361;</h1>
<pre><code>        &lt;style type=&quot;text/css&quot;&gt;
            *{
                margin: 0;
                padding: 0;
                list-style: none;
            }
            .web{
                width: 300px;
                height: 300px;
                border: 2px solid #000000;
            }
            ul{overflow: hidden;}
            li{
                float: left;
                width: 100px;
                box-sizing: border-box;
                border: 1px solid #000000;
                cursor: pointer;
                text-align: center;
            }
            li:active{
                background: gainsboro;
            }

            .content{
                width: 100%;
                height: 100%;
                position: relative;
            }
            .content div{
                position: absolute;
                top: 0;
                left: 0;
                display: none;
            }
            .content div:nth-child(1){
                display: block;

            }
            .nav {
                width: 500px;
                height: 200px;
                border: 1px solid #00008B;
                margin-top: 100px;
            }

            .xuan {
                text-align: center;
            }

            .xuan li {
                width: 100px;
                height: 60px;
                text-align: center;
                font-size: 20px;
                line-height: 60px;
                border: 1px solid #00008B;
                margin-left: 20px;
            }

            .test {
                text-align: center;
                position: relative;
            }

            .test div {
                position: absolute;
                top: 0;
                display: none;
            }

            .test div:nth-child(1) {
                display: block;
            }
        &lt;/style&gt;
        &lt;div class=&quot;web&quot;&gt;
            &lt;ul&gt;
                &lt;li&gt;html&lt;/li&gt;
                &lt;li&gt;css&lt;/li&gt;
                &lt;li&gt;js&lt;/li&gt;
            &lt;/ul&gt;
            &lt;div class=&quot;content&quot;&gt;
                &lt;div&gt;html&#x662F;&#x8D85;&#x6587;&#x672C;&lt;/div&gt;
                &lt;div&gt;css&#x662F;&lt;/div&gt;
                &lt;div&gt;js&#x662F;&lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class=&quot;nav&quot;&gt;
            &lt;ul class=&quot;xuan&quot;&gt;
                &lt;li&gt;&#x70B9;&#x51FB;&lt;/li&gt;
                &lt;li&gt;&#x4E8B;&#x4EF6;&lt;/li&gt;
                &lt;li&gt;&#x8FC7;&#x540E;&lt;/li&gt;
            &lt;/ul&gt;
            &lt;div class=&quot;test&quot;&gt;
                &lt;div&gt;&#x70B9;&#x51FB;&lt;/div&gt;
                &lt;div&gt;&#x4E8B;&#x4EF6;&lt;/div&gt;
                &lt;div&gt;&#x8FC7;&#x540E;&lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        &lt;script type=&quot;text/javascript&quot;&gt;
            var ali = document.querySelectorAll(&quot;li&quot;);
            var caont = document.querySelectorAll(&quot;.content div&quot;);
            //&#x65B9;&#x6CD5;&#x4E00;
            /*
            ali[0].addEventListener(&quot;click&quot;,function(){
                caont[0].style.display=&quot;block&quot;;
                caont[1].style.display=&quot;none&quot;;
                caont[2].style.display=&quot;none&quot;;
            })
            ali[1].addEventListener(&quot;click&quot;,function(){
                caont[0].style.display=&quot;none&quot;;
                caont[1].style.display=&quot;block&quot;;
                caont[2].style.display=&quot;none&quot;;
            })
            ali[2].addEventListener(&quot;click&quot;,function(){
                caont[0].style.display=&quot;none&quot;;
                caont[1].style.display=&quot;none&quot;;
                caont[2].style.display=&quot;block&quot;;
            })*/

            //&#x65B9;&#x6CD5;&#x4E8C;
            for (var i=0;i&lt;ali.length;i++) {
                ali[i].index=i;
                ali[i].addEventListener(&quot;click&quot;,function(){
                    //console.log(i);//3
                    //console.log(this.index);
                    for (var j=0;j&lt;caont.length;j++) {
                        caont[j].style.display=&quot;none&quot;;
                    }
                    caont[this.index].style.display=&quot;block&quot;;
                })
            }
            //&#x65B9;&#x6CD5;&#x4E09;
            var ali = document.querySelectorAll(&quot;.xuan li&quot;);
            var test = document.querySelectorAll(&quot;.test div&quot;)
            for(var i = 0; i &lt; ali.length; i++) {
                (function(k) {
                    ali[i].addEventListener(&quot;click&quot;, function() {
                        for(var j = 0; j &lt; ali.length; j++) {
                            test[j].style.display = &quot;none&quot;;
                        }
                        test[k].style.display = &quot;block&quot;;
                    })
                })(i);
            }
        &lt;/script&gt;
</code></pre><h1 id="&#x8868;&#x683C;&#x589E;&#x5220;&#x6539;&#x67E5;">&#x8868;&#x683C;&#x589E;&#x5220;&#x6539;&#x67E5;</h1>
<pre><code>        &lt;input type=&quot;number&quot; class=&quot;userinfo&quot;  placeholder=&quot;&#x8BF7;&#x8F93;&#x5165;&#x5B66;&#x53F7;&quot; /&gt;
        &lt;input type=&quot;text&quot;  class=&quot;userinfo&quot;  placeholder=&quot;&#x8BF7;&#x8F93;&#x5165;&#x59D3;&#x540D;&quot; /&gt;
        &lt;input type=&quot;text&quot; class=&quot;userinfo&quot;   placeholder=&quot;&#x8BF7;&#x8F93;&#x5165;&#x6027;&#x522B;&quot; /&gt;
        &lt;input type=&quot;number&quot;  class=&quot;userinfo&quot;  placeholder=&quot;&#x8BF7;&#x8F93;&#x5165;&#x73ED;&#x7EA7;&quot; /&gt;
        &lt;input type=&quot;button&quot; class=&quot;add&quot; value=&quot;&#x6DFB;&#x52A0;&quot; /&gt;
        &lt;input type=&quot;text&quot; class=&quot;search&quot; placeholder=&quot;&#x8BF7;&#x8F93;&#x5165;&#x641C;&#x7D22;&#x5185;&#x5BB9;&quot; /&gt;
        &lt;input type=&quot;button&quot; class=&quot;searchBtn&quot; value=&quot;&#x641C;&#x7D22;&quot; /&gt;
        &lt;!--&#x6839;&#x636E;&#x5B66;&#x53F7;&#x6392;&#x5E8F;--&gt;
        &lt;input type=&quot;button&quot; class=&quot;sortbtn&quot; value=&quot;&#x6392;&#x5E8F;&quot; /&gt;
        &lt;table border=&quot;&quot; width=&quot;600&quot;&gt;
            &lt;tr&gt;&lt;th&gt;&#x5B66;&#x53F7;&lt;/th&gt;&lt;th&gt;&#x59D3;&#x540D;&lt;/th&gt;&lt;th&gt;&#x6027;&#x522B;&lt;/th&gt;&lt;th&gt;&#x73ED;&#x7EA7;&lt;/th&gt;&lt;th&gt;&#x64CD;&#x4F5C;&lt;/th&gt;&lt;/tr&gt;
        &lt;/table&gt;
        &lt;script type=&quot;text/javascript&quot;&gt;
            //&#x6DFB;&#x52A0;&#x6761;&#x76EE;
            function getInfo(){
                var inps = document.querySelectorAll(&quot;.userinfo&quot;),
                    num = inps[0].value,
                    name = inps[1].value,
                    sex = inps[2].value,
                    clas = inps[3].value;
                    if(num==&quot;&quot; || name==&quot;&quot; || sex==&quot;&quot; || clas==&quot;&quot;){
                        alert(&quot;&#x8BF7;&#x8F93;&#x5165;&#x5B8C;&#x6574;&#x4FE1;&#x606F;&quot;);
                        return &quot;&quot;;
                    }
                //es5&#x5B57;&#x7B26;&#x4E32;&#x62FC;&#x63A5;&#x65B9;&#x6CD5;
                //var tr = &quot;&lt;tr&gt;&lt;td&gt;&quot;+num+&quot;&lt;/td&gt;&lt;td&gt;&quot;+name+&quot;&lt;/td&gt;&lt;td&gt;&quot;+sex+&quot;&lt;/td&gt;&lt;td&gt;&quot;+clas+&quot;&lt;/td&gt;&lt;/tr&gt;&quot;;
                //es6&#x5B57;&#x7B26;&#x4E32;&#x62FC;&#x63A5;&#x65B9;&#x6CD5;
                var tr = `
                        &lt;tr&gt;
                            &lt;td&gt;${num}&lt;/td&gt;
                            &lt;td&gt;${name}&lt;/td&gt;
                            &lt;td&gt;${sex}&lt;/td&gt;
                            &lt;td&gt;${clas}&lt;/td&gt;
                            &lt;td align=&quot;center&quot;&gt;&lt;button class=&quot;del&quot;&gt;&#x5220;&#x9664;&lt;/button&gt;&lt;button class=&quot;change&quot;&gt;&#x4FEE;&#x6539;&lt;/button&gt;&lt;/button&gt;&lt;button class=&quot;conf&quot;&gt;&#x786E;&#x8BA4;&#x4FEE;&#x6539;&lt;/button&gt;&lt;/td&gt;
                        &lt;/tr&gt;
                        `
                return tr;
            }
            var add = document.querySelector(&quot;.add&quot;);
            var tab = document.querySelector(&quot;table&quot;);
            //&#x6DFB;&#x52A0;&#x6761;&#x76EE;
            add.addEventListener(&quot;click&quot;,function(){
                tab.innerHTML += getInfo();
                del();
                change();

            })
            //&#x5220;&#x9664;
            function del(){
                var del = document.querySelectorAll(&quot;.del&quot;);
                for (var i=0;i&lt;del.length;i++) {
                    del[i].addEventListener(&quot;click&quot;,function(){
                        //&#x83B7;&#x53D6;&#x5143;&#x7D20;&#x7236;&#x8282;&#x70B9;
                        this.parentNode.parentNode.remove();
                    });    
                };
            }
            //&#x4FEE;&#x6539;
            function change(){
                var change = document.querySelectorAll(&quot;.change&quot;);
                var confChange = document.querySelectorAll(&quot;.conf&quot;);
                //&#x53EF;&#x4EE5;&#x5148;&#x628A;change&#x7684;&#x957F;&#x5EA6;&#x5B58;&#x8D77;&#x6765;&#xFF0C;&#x4EE5;&#x4FBF;&#x5FAA;&#x73AF;&#x7684;&#x65F6;&#x5019;&#x4F7F;&#x7528;&#xFF0C;&#x63D0;&#x9AD8;&#x4EE3;&#x7801;&#x6027;&#x80FD;
                var leng= change.length;
                var conleng = confChange.length;
                //&#x4FEE;&#x6539;
                for (var i=0;i&lt;leng;i++) {
                    change[i].addEventListener(&quot;click&quot;,function(){
                        //console.log(this.parentNode.parentNode.children);
                        var atd = this.parentNode.parentNode.children;
                        var leng =atd.length-1;
                        for (var j=0;j&lt;leng;j++) {
                            atd[j].contentEditable=true;
                        };
                        //&#x83B7;&#x53D6;&#x7126;&#x70B9;
                        atd[0].focus();
                    });

                };
                //&#x786E;&#x5B9A;&#x4FEE;&#x6539;
                for (var k=0;k&lt;conleng;k++) {
                    confChange[k].addEventListener(&quot;click&quot;,function(){
                        var atd = this.parentNode.parentNode.children;
                        var leng = atd.length-1;
                        for (var j=0;j&lt;leng;j++) {
                            atd[j].contentEditable=false;
                        };
                    });
                };
            }
            //&#x641C;&#x7D22;(&#x6839;&#x636E;&#x59D3;&#x540D;&#x641C;&#x7D22;)
            function search(){
                var seabtn = document.querySelector(&quot;.searchBtn&quot;);
                seabtn.addEventListener(&quot;click&quot;,function(){
                    var searvalue = document.querySelector(&quot;.search&quot;).value;
                    //trim()&#x53BB;&#x9664;&#x5B57;&#x7B26;&#x4E32;&#x524D;&#x540E;&#x7A7A;&#x683C;
                    searvalue = searvalue.trim();
                    var tr = document.querySelectorAll(&quot;table tr&quot;);
                    console.log(tr);
                    var leng = tr.length;
                    var check = false;
                    for (var i=1;i&lt;leng;i++) {
                        if(searvalue == tr[i].children[1].innerText){
                            tr[i].style.background=&quot;skyblue&quot;;
                            check=true;
                        }else{
                            tr[i].style.background=&quot;#fff&quot;;
                            console.log(i,leng);
                        }
                    }
                    if(check == false){
                        alert(&quot;&#x6CA1;&#x6709;&#x4F60;&#x60F3;&#x8981;&#x7684;&#x6570;&#x636E;&quot;);

                    }
                })
            }search();
            //&#x6392;&#x5E8F;(&#x6839;&#x636E;&#x5B66;&#x53F7;&#x8FDB;&#x884C;&#x6392;&#x540D;)
            function sortNum(){
                var tab = document.querySelector(&quot;table&quot;);
                var sortbtn = document.querySelector(&quot;.sortbtn&quot;);
                sortbtn.addEventListener(&quot;click&quot;,function(){
                    var arr = [];
                    var tr = document.querySelectorAll(&quot;table tr&quot;);
                //    console.log(tr);
                    var trleng=tr.length;
                    for (var i=1;i&lt;trleng;i++){
                        arr.push(tr[i]);
                    }
                    //&#x5192;&#x6CE1;&#x6392;&#x5E8F;
                    for (var j=0;j&lt;trleng-1;j++){
                        for (var k=0;k&lt;trleng-1;k++){
                            var num1 = parseInt(arr[j].children[0].innerText);
                            var num2 = parseInt(arr[k].children[0].innerText);
                            if(num1&lt;num2){
                                var tem = arr[k];
                                arr[k] = arr[j];
                                arr[j] = tem;
                            }
                        }
                    }
                    //console.log(arr);
                    //&#x5C06;&#x6392;&#x5E8F;&#x597D;&#x7684;tr&#x6570;&#x7EC4;&#xFF0C;&#x91CD;&#x65B0;&#x6E32;&#x67D3;&#x5230;&#x9875;&#x9762;&#xB7;
                    for (var k=0;k&lt;trleng-1;k++) {
                        tab.appendChild( arr[k]);
                    }
                })
            }sortNum();
        &lt;/script&gt;
</code></pre><h1 id="&#x624B;&#x98CE;&#x7434;">&#x624B;&#x98CE;&#x7434;</h1>
<pre><code>        &lt;style type=&quot;text/css&quot;&gt;
            *{
                margin: 0;
                padding: 0;
                list-style: none;
            }
            .web ul{
                overflow: hidden;
            }
            .web li{
                width: 100px;
                height: 500px;
                float: left;
                cursor: pointer;
                transition: 500ms;
            }
            .title{
                width: 20px;
                margin: 230px auto;
            }
            .web li:nth-child(1){
                background: skyblue;
            }
            .web li:nth-child(2){
                background: pink;
            }
            .web li:nth-child(3){
                background: gray;
            }
            .web li:nth-child(4){
                background: gold;
            }

            .content{
                display: none;
            }
            li:nth-child(1) .title{
                display: none;
            }
            li:nth-child(1) .content{
                display: block;
            }
            .web li:nth-child(1){
                width: 300px;
            }
        &lt;/style&gt;
        &lt;div class=&quot;web&quot;&gt;
            &lt;ul&gt;
                &lt;li&gt;
                    &lt;div class=&quot;title&quot;&gt;&#x6807;&#x9898;1&lt;/div&gt;
                    &lt;div class=&quot;content&quot;&gt;&#x5185;&#x5BB9;1&lt;/div&gt;
                &lt;/li&gt;
                &lt;li&gt;
                    &lt;div class=&quot;title&quot;&gt;&#x6807;&#x9898;2&lt;/div&gt;
                    &lt;div class=&quot;content&quot;&gt;&#x5185;&#x5BB9;2&lt;/div&gt;
                &lt;/li&gt;
                &lt;li&gt;
                    &lt;div class=&quot;title&quot;&gt;&#x6807;&#x9898;3&lt;/div&gt;
                    &lt;div class=&quot;content&quot;&gt;&#x5185;&#x5BB9;3&lt;/div&gt;
                &lt;/li&gt;
                &lt;li&gt;
                    &lt;div class=&quot;title&quot;&gt;&#x6807;&#x9898;4&lt;/div&gt;
                    &lt;div class=&quot;content&quot;&gt;&#x5185;&#x5BB9;4&lt;/div&gt;
                &lt;/li&gt;
            &lt;/ul&gt;
        &lt;/div&gt;
        &lt;script type=&quot;text/javascript&quot;&gt;
            var ali = document.querySelectorAll(&quot;li&quot;);
            for (var i=0;i&lt;ali.length;i++) {
                ali[i].index=i;
                ali[i].addEventListener(&quot;click&quot;,function(){
                //    console.log(this.index);4
                    //title.style.display=&quot;block&quot;;
                    for (var j=0;j&lt;ali.length;j++){
                        ali[j].children[0].style=&quot;display:block&quot;;
                        ali[j].children[1].style=&quot;display:none&quot;;
                        ali[j].style.width=&quot;100px&quot;;
                    }
                    this.children[0].style=&quot;display:none&quot;;
                    this.children[1].style=&quot;display:block&quot;;
                    this.style.width=&quot;300px&quot;;
                })

            }

            for (let i=0;i&lt;ali.length;i++){
                ali[i].addEventListener(&quot;click&quot;,function(){
                    console.log(i);
                })
            }
            //&#x95ED;&#x5305;&#x65B9;&#x6CD5;
            /*for (var j=0;j&lt;ali.length;j++){
                (function(k){
                    ali[k].addEventListener(&quot;click&quot;,function(){
                        for (var i=0;i&lt;ali.length;i++) {
                            ali[i].children[0].style.display=&quot;block&quot;;
                            ali[i].children[1].style.display=&quot;none&quot;;
                            ali[i].style.width=&quot;100px&quot;;
                        }
                        ali[k].children[0].style.display=&quot;none&quot;;
                        ali[k].children[1].style.display=&quot;block&quot;;
                        ali[k].style.width=&quot;300px&quot;;
                    })
                })(j)
            }*/

        &lt;/script&gt;
</code></pre><h1 id="&#x6DD8;&#x5B9D;&#x8D2D;&#x7269;&#x7B5B;&#x9009;&#x6548;&#x679C;">&#x6DD8;&#x5B9D;&#x8D2D;&#x7269;&#x7B5B;&#x9009;&#x6548;&#x679C;</h1>
<pre><code>        &lt;style type=&quot;text/css&quot;&gt;
            *{
                margin: 0;
                padding: 0;
                list-style: none;
            }
            .web{
                width: 500px;
                margin: 20px auto;
            }
            .option{
                font-size: 16px;
                border-bottom: 1px solid #bbb;
            }
            .option li{
                margin-bottom: 20px;
            }
            .option span{
                display: inline-block;
                color: #666;
                padding: 5px 10px;
                border: 2px solid #999;
            }
            .option li&gt;span{
                cursor: pointer;
            }
            .option p{
                /*font-weight: bold;*/
                display: inline-block;
                width: 50px;
                text-align: center;
                color: #000;
                border: 1px solid transparent;
            }
            .option .active{
                border: 2px solid #f60;
            }
            .price{
                margin-top: 20px;
            }
            .price em{
                font-style: normal;
                font-size: 22px;
                color: #f60;
            }
            input{
                width: 380px;
                height: 45px;
                line-height: 45px;
                background: #f60;
                border: none;
                outline: none;
                color: #fff;
                font-size: 23px;
                margin-top: 20px;
            }
        &lt;/style&gt;
        &lt;div class=&quot;web&quot;&gt;
            &lt;ul class=&quot;option&quot;&gt;
                &lt;li class=&quot;type model&quot;&gt;
                    &lt;p&gt;&#x578B;&#x53F7;&lt;/p&gt;
                    &lt;span class=&quot;active&quot;&gt;4.7&#x82F1;&#x5BF8;&lt;/span&gt;
                    &lt;span&gt;5.5&#x82F1;&#x5BF8;&lt;/span&gt;
                &lt;/li&gt;
                &lt;li class=&quot;type color&quot;&gt;
                    &lt;p&gt;&#x989C;&#x8272;&lt;/p&gt;
                    &lt;span class=&quot;active&quot;&gt;&#x94F6;&#x8272;&lt;/span&gt;
                    &lt;span&gt;&#x91D1;&#x8272;&lt;/span&gt;
                    &lt;span&gt;&#x6DF1;&#x7A7A;&#x7070;&#x8272;&lt;/span&gt;
                &lt;/li&gt;
                &lt;li class=&quot;type Memory&quot;&gt;
                    &lt;p&gt;&#x5185;&#x5B58;&lt;/p&gt;
                    &lt;span class=&quot;active&quot;&gt;16GB&lt;/span&gt;
                    &lt;span&gt;64GB&lt;/span&gt;
                    &lt;span&gt;128GB&lt;/span&gt;
                &lt;/li&gt;
                &lt;li class=&quot;type edition&quot;&gt;
                    &lt;p&gt;&#x7248;&#x672C;&lt;/p&gt;
                    &lt;span class=&quot;active&quot;&gt;&#x516C;&#x5F00;&#x7248;&lt;/span&gt;
                    &lt;span&gt;&#x79FB;&#x52A8;&#x8D60;&#x8D39;&#x7248;&lt;/span&gt;
                    &lt;span&gt;&#x8054;&#x901A;&#x5408;&#x7EA6;&#x7248;&lt;/span&gt;
                &lt;/li&gt;
            &lt;/ul&gt;
            &lt;div class=&quot;price&quot;&gt;&#x4EF7;&#x683C;&#xFF1A;&lt;em&gt;&#xFFE5;5288.00&lt;/em&gt;&lt;/div&gt;
            &lt;input type=&quot;button&quot; onclick=&quot;alert(&apos;2345&apos;)&quot; value=&quot;&#x7ACB;&#x5373;&#x8D2D;&#x4E70;&quot; /&gt;
        &lt;/div&gt;
        &lt;script type=&quot;text/javascript&quot;&gt;
            var modspan = document.querySelectorAll(&quot;.model span&quot;);
            var menspan = document.querySelectorAll(&quot;.Memory span&quot;);
            var aspan = document.querySelectorAll(&quot;span&quot;);
            var totaprice = document.querySelector(&quot;.price em&quot;);
            //console.log(aspan);
            for (var i=0;i&lt;aspan.length;i++){
                aspan[i].addEventListener(&quot;click&quot;,function(){
                    //&#x83B7;&#x53D6;&#x5230;&#x7236;&#x7EA7;&#x5143;&#x7D20;&#x540C;&#x4E00;&#x7EA7;&#x7684;&#x5B50;&#x5143;&#x7D20;
                    var allChild = this.parentNode.children;
                    //console.log(allChild);
                    for (var j=1;j&lt;allChild.length;j++) {
                        allChild[j].classList.remove(&quot;active&quot;);
                    }
                    this.classList.add(&quot;active&quot;);
                    Price();
                });
            }

            function Price(){
                var p1 = 0;//&#x8868;&#x793A;&#x578B;&#x53F7;&#x7684;&#x52A0;&#x683C;
                var p2 = 0;//&#x5185;&#x5B58;&#x7684;&#x4EF7;&#x683C;
                //modspan
                //classList.contains(classname)
                //&#x7528;&#x6765;&#x68C0;&#x6D4B;ele&#x8FD9;&#x4E2A;&#x5143;&#x7D20;&#x91CC;&#x9762;&#x662F;&#x5426;&#x6709;classname&#x8FD9;&#x4E2A;&#x7C7B;&#x540D;&#xFF0C;&#x5982;&#x679C;&#x6709;&#x8FD4;&#x56DE;true&#xFF0C;&#x5426;&#x5219;&#x8FD4;&#x56DE;false
                for (var i=0;i&lt;modspan.length;i++){
                    if(modspan[i].classList.contains(&quot;active&quot;)){
                        p1 = i==0?5288.00:6088.00;
                    }
                }
                for (var j=0;j&lt;menspan.length;j++) {
                    if(menspan[j].classList.contains(&quot;active&quot;)){
                    //    p2 = j==0?0:j==1?800:1600;
                    //&#x4E0A;&#x9762;&#x4E09;&#x5143;&#x8FD0;&#x7B97;&#x7B26;&#x76F8;&#x5F53;&#x4E8E;&#x4E0B;&#x9762;&#x7684;if&#x8BED;&#x53E5;
                        if(j==0){
                            p2=0;
                        }else if(j==1){
                            p2=800;
                        }else{
                            p2=1600;
                        }
                    }
                }
                console.log(p1+p2);
                totaprice.innerText=&quot;&#xFFE5;&quot;+(p1+p2).toFixed(2);
            }

        &lt;/script&gt;
</code></pre><h1 id="&#x8BC4;&#x8BBA;&#x5B57;&#x6570;&#x76D1;&#x542C;">&#x8BC4;&#x8BBA;&#x5B57;&#x6570;&#x76D1;&#x542C;</h1>
<pre><code>        &lt;style type=&quot;text/css&quot;&gt;
            .txt textarea{
                width: 300px;
                height: 150px;
                border: none;
                outline: none;
            }
            .txt{
                display: inline-block;
                position: relative;
                border: 1px solid #000;
            }
            .txt span{
                position: absolute;
                right: 5px;
                bottom: 5px;
            }
        &lt;/style&gt;
        &lt;div class=&quot;txt&quot;&gt;
            &lt;textarea &gt;&lt;/textarea&gt;
            &lt;span&gt;120&lt;/span&gt;
        &lt;/div&gt;
        &lt;script type=&quot;text/javascript&quot;&gt;
            var texta = document.querySelector(&quot;.txt textarea&quot;);
            var sp = document.querySelector(&quot;.txt span&quot;);
            var maxnum=sp.innerText;
            console.log(maxnum);
            texta.addEventListener(&quot;input&quot;,function(){
                //&#x65B9;&#x6CD5;&#x4E00;
                //texta.setAttribute(&quot;maxlength&quot;,&quot;20&quot;);
                //&#x65B9;&#x6CD5;&#x4E8C;
                if(texta.value.length&gt;=20){
                    var atxt = texta.value;
                    atxt = atxt.slice(0,20);
                    texta.value = atxt;
                }
                var curspnum=texta.value.length;
                sp.innerText=maxnum-curspnum;
            })
        &lt;/script&gt;
</code></pre>
                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../../md/js/DOM元素对象.html" class="navigation navigation-prev " aria-label="Previous page: DOM元素对象"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../../md/js/DOM鼠标事件.html" class="navigation navigation-next " aria-label="Next page: DOM鼠标事件"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../../gitbook/app.js"></script>

    
    <script src="../../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-livereload/plugin.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"livereload":{}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
